<%--
    Document   : right
    Created on : Dec 1, 2011, 10:59:19 AM
    Author     : BlueZky
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<link rel="stylesheet" type="text/css" href="styles/userstyles.css"/>

<div class="rightSid">
    <!-- Login box-->
    <div class="sidebar-box">
        <div class="sidebar-top">ĐĂNG NHẬP</div>
        <div class="sidebar-mid">
            <c:if test="${sessionScope.nguoiDung eq null}">
                <form method="post" action="gate.htm">
                    <input type="hidden" name="a" value="li"/>
                    <input type="text" name="userName" id="userName" class="login-box" placeholder="Tên đăng nhập"/>
                    <input type="password" name="password" id="password" class="login-box" placeholder="Mật khẩu"/>
                    <div class="login" >
                        <input type="submit" class="btnlogin" value="Đăng nhập"/>
                        <a href="dangky.htm">Đăng ký</a> |<a href="quenmatkhau.htm"> Quên mật khẩu</a>
                    </div>
                </form>
            </c:if>
            <c:if test="${sessionScope.nguoiDung ne null}">
                <div class="login">
                    Xin chào <b ><a href="taikhoan.htm" style="color: orange;">${sessionScope.nguoiDung.tendangnhap}</a></b>

                    <c:if test="${sessionScope.quyen ne null}">
                        <div><b><a href='admin.htm'>Trang quản trị</a></b></div>
                    </c:if>

                    <br/><b><a href="taikhoan.htm">Tài khoản</a></b> | <a href="gate.htm?a=lo">Thoát</a>
                </div>
            </c:if>
        </div>
        <div class="sidebar-bottom"></div>
    </div>

    <!-- End Login box-->

    <!--Cart-->
    <div class="sidebar-box">
        <div class="sidebar-top">GIỎ HÀNG</div>
        <div class="sidebar-mid">
            <div class="cart-img">
                <a href="giohang.htm"><img src="images/cart.png" width="55" height="55"></a>
            </div>

            <c:if test="${sessionScope.gioHang eq null}">
                <div class="cart-content"> Không có hàng trong giỏ</div>
            </c:if>
            <c:if test="${sessionScope.gioHang ne null}">
                <c:set var="sum" value="0"></c:set>
                <c:set var="soluong" value="0"></c:set>
                <c:forEach items="${sessionScope.gioHang}" var="item" varStatus="status">
                    <c:set var="sum" value="${sum + item.gia*item.soluongton}"></c:set>
                    <c:set var="soluong" value="${soluong + item.soluongton}"></c:set>
                </c:forEach>
                <table cellspacing="0px" class="rtable">
                    <tr>
                        <td style="text-align: right; padding-right: 3px; width: 50%;">Số SP:</td>
                        <td style="color:orange; font-size: 14px;">${soluong}</td>
                    </tr>
                    <tr>
                        <td style="text-align: right; padding-right: 3px;">Thành tiền:</td>
                        <td style="color:orange;  font-size: 14px;"><fmt:formatNumber value="${sum}" maxFractionDigits="2"/> $</td>
                    </tr>
                </table>
            </c:if>
        </div>
    </div>
    <!--End Cart-->
</div>